<?php

namespace mpend\modules\cms\models;

use Yii;
use common\helpers\Url;

/**
 * 统一搜索模型
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class ArticleViewSearch extends \common\models\cms\CmsArticle {

    public function getText() {
        return $this->data ? $this->data->body : $this->description;
    }

    public function fields() {
        return [
            'id',
            'title',
            'thumb',
            'video',
            'images' => 'album',
            'text',
            'likes',
            'views',
            'liked',
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function afterFind() {
        parent::afterFind();
        parent::growUpViews();
    }

}
